/* 
 * File:   debugprintdetail.cpp
 * Author: meng
 * 
 * Created on May 5, 2011, 2:27 PM
 */

#include <sstream>

#include "debugprintdetail.h"
#include "rectype.h"
#include "recbase.h"
#include "far.h"
#include "atr.h"
#include "mir.h"
#include "mrr.h"
#include "pcr.h"
#include "hbr.h"
#include "sdr.h"
#include "sbr.h"
#include "pmr.h"
#include "pgr.h"
#include "plr.h"
#include "rdr.h"
#include "wir.h"
#include "wrr.h"
#include "wcr.h"
#include "pir.h"
#include "prr.h"
#include "tsr.h"
#include "ptr.h"
#include "bps.h"
#include "eps.h"
#include "gdr.h"
#include "dtr.h"
#include "ftr.h"
#include "mpr.h"
#include <string>


#include "stdffield.h"
#include "stdffield.cpp"

#include "gdrstdffield.h"
// #include "gdrstdffield.cpp"

using namespace std;
using namespace opsrc;
using namespace opsrc::stdf;

const string tab1 = "\t";
const string tab2 = "\t\t";
const string tab3 = "\t\t\t";
const string listsep = "|";


DebugPrintDetail::DebugPrintDetail() {
    m_type = 0;
}



DebugPrintDetail::~DebugPrintDetail() {
}




void DebugPrintDetail::out(RecBase* rec) {
    stdf_rec rt = rec->getStdfRec();
    switch (rt) {

    case ATR:
        {
            Atr* p = dynamic_cast<Atr*>(rec);
            this->printHeaderInfo(p);

            StdfField<long> mod_tim = p->getModTime();
            printFieldInfo("mod_tim\0", mod_tim, rec->getFileRecByteStartPosition());

            StdfField<string> cmd_lin = p->getCmdLine();
            printFieldInfo("cmd_lin\0", cmd_lin, rec->getFileRecByteStartPosition());
        }
        break;

    case BPS:
        {
            Bps* p = dynamic_cast<Bps*>(rec);
            printHeaderInfo(rec);

            StdfField<string> seq_nam = p->getSequenceName();
            printFieldInfo("seq_nam\0", seq_nam, p->getFileRecByteStartPosition());

        }
        break;

    case DTR:
        {
            Dtr* p = dynamic_cast<Dtr*>(rec);
            printHeaderInfo(rec);

            StdfField<string> text_dat = p->getTextData();
            printFieldInfo("text_dat\0", text_dat, p->getFileRecByteStartPosition());

        }
        break;

    case EPS:
        {
            Eps* p = dynamic_cast<Eps*>(rec);
            printHeaderInfo(p);

        }
        break;

    case FAR:
        {
            Far* p = dynamic_cast<Far*>(rec);
            printHeaderInfo(rec);


            StdfField<unsigned int>  cpu_type = p->getCpuType();
            printFieldInfo("cpu_type\0", cpu_type, p->getFileRecByteStartPosition(), &Util::getCpuEndian);

            StdfField<unsigned int>  stdf_ver = p->getStdfVersion();
            printFieldInfo("stdf_ver\0", stdf_ver, p->getFileRecByteStartPosition());

        }
        break;
    case FTR:
        {
            Ftr* p = dynamic_cast<Ftr*>(rec);
            this->printHeaderInfo(rec);

            StdfField<long> test_num = p->getTestNumber();
            printFieldInfo("test_num\0", test_num, rec->getFileRecByteStartPosition());

            StdfField<int> head_num = p->getHeadNumber();
            printFieldInfo("head_num\0", head_num, rec->getFileRecByteStartPosition());

            StdfField<int> site_num = p->getSiteNumber();
            printFieldInfo("site_num\0", site_num, rec->getFileRecByteStartPosition());

            StdfField<vector<bool> > test_flag = p->getTestFlag();
            printFieldInfo("test_flag\0", test_flag, rec->getFileRecByteStartPosition());

            StdfField<vector<bool> > opt_flag = p->getOptionFlag();
            printFieldInfo("opt_flag\0", opt_flag, rec->getFileRecByteStartPosition());

            StdfField<int> cycl_cnt = p->getCycleCount();
            printFieldInfo("cycl_cnt\0", cycl_cnt, rec->getFileRecByteStartPosition());

            StdfField<long> rel_vadr = p->getRelativeVectorAddress();
            printFieldInfo("rel_vadr\0", rel_vadr, rec->getFileRecByteStartPosition());

            StdfField<long> rept_cnt = p->getRepeatedVectorCount();
            printFieldInfo("rept_cnt\0", rept_cnt, rec->getFileRecByteStartPosition());

            StdfField<long> num_fail = p->getPinFailureCount();
            printFieldInfo("num_fail\0", num_fail, rec->getFileRecByteStartPosition());

            StdfField<unsigned long> xfail_ad = p->getXlogicalDeviceAddressFailure();
            printFieldInfo("xfail_ad\0", xfail_ad, rec->getFileRecByteStartPosition());

            StdfField<unsigned long> yfail_ad = p->getYlogicalDeviceAddressFailure();
            printFieldInfo("yfail_ad\0", yfail_ad, rec->getFileRecByteStartPosition());

            StdfField<int> vect_off = p->getVectorOffset();
            printFieldInfo("vect_off\0", vect_off, rec->getFileRecByteStartPosition());

            StdfField<int> rtn_icnt = p->getPmrCountIndexes();
            printFieldInfo("rtn_ict\0", rtn_icnt, rec->getFileRecByteStartPosition());

            StdfField<int> pgm_icnt = p->getProgramStateIndexes();
            printFieldInfo("pgm_icnt\0", pgm_icnt, rec->getFileRecByteStartPosition());

            StdfField<vector<int> > rtn_indx = p->getPmrArrayData();
            printFieldInfo("rtn_indx\0", rtn_indx, rec->getFileRecByteStartPosition());

            StdfField<vector<int> > rtn_stat = p->getPmrArrayState();
            printFieldInfo("rtn_stat\0", rtn_stat, rec->getFileRecByteStartPosition());

            StdfField<vector<int> > pgm_indx = p->getProgramsStateIndexArray();
            printFieldInfo("pgm_indx\0", pgm_indx, rec->getFileRecByteStartPosition());

            StdfField<vector<int> > pgm_stat = p->getProgramStateDataArray();
            printFieldInfo("pgm_stat\0", pgm_stat, rec->getFileRecByteStartPosition());

            StdfField<int> fail_pin = p->getFailPinBitMapLength();
            printFieldInfo("fail_pin\0", fail_pin, rec->getFileRecByteStartPosition());

            StdfField<string> vect_nam = p->getVectorModulePatternName();
            printFieldInfo("vect_nam\0", vect_nam, rec->getFileRecByteStartPosition());

            StdfField<string> time_set = p->getTimeSetName();
            printFieldInfo("time_set\0", time_set, rec->getFileRecByteStartPosition());

            StdfField<string> op_code = p->getVectorOpCode();
            printFieldInfo("op_code\0", op_code, rec->getFileRecByteStartPosition());

            StdfField<string> test_txt = p->getDescriptiveText();
            printFieldInfo("test_txt\0", test_txt, rec->getFileRecByteStartPosition());

            StdfField<string> alrm_id = p->getAlarmId();
            printFieldInfo("alrm_id\0", alrm_id, rec->getFileRecByteStartPosition());

            StdfField<string> prog_txt = p->getAdditonalProgramInfo();
            printFieldInfo("prog_txt\0", prog_txt, rec->getFileRecByteStartPosition());

            StdfField<string> rslt_txt = p->getAdditionalResultInfo();
            printFieldInfo("rslt_txt\0", rslt_txt, rec->getFileRecByteStartPosition());

            StdfField<int> patg_num = p->getPatternGenertorNumber();
            printFieldInfo("patg_num\0", patg_num, rec->getFileRecByteStartPosition());

            StdfField<int> spin_map = p->getEnabledComparatorBitMap();
            printFieldInfo("spin_map\0", spin_map, rec->getFileRecByteStartPosition());


        }
        break;

    case GDR:
        {
            Gdr* p = dynamic_cast<Gdr*>(rec);
            printHeaderInfo(rec);

            StdfField<int> fld_cnt = p->getFieldCount();
            printFieldInfo("fld_cnt\0", fld_cnt, rec->getFileRecByteStartPosition());

            int c = fld_cnt.getData();
            if (c==0) break;



            for (int i=0; i<c; i++) {
                 GdrStdfField* pgdrfield = p->getGdrStdfField(i);
                 std::stringstream out;
                 out << "F" << i;
                 printFieldInfo(out.str().c_str(), *pgdrfield, rec->getFileRecByteStartPosition());
             }



        }
        break;

    case HBR:
        {
            Hbr* p = dynamic_cast<Hbr*>(rec);
            printHeaderInfo(rec);

            StdfField<int> head_num = p->getHeadNum();
            printFieldInfo("head_num\0", head_num, rec->getFileRecByteStartPosition());

            StdfField<int> site_num = p->getSiteNum();
            printFieldInfo("site_num\0", site_num, rec->getFileRecByteStartPosition());

            StdfField<int> hbin_num = p->getHbinNum();
            printFieldInfo("hbin_num\0", hbin_num, rec->getFileRecByteStartPosition());

            StdfField<long> hbin_cnt = p->getHbinCount();
            printFieldInfo("hbin_cnt\0", hbin_cnt, rec->getFileRecByteStartPosition());

            StdfField<string> hbin_pf = p->getHbinPassFail();
            printFieldInfo("hbin_pf\0", hbin_pf, rec->getFileRecByteStartPosition());

            StdfField<string> hbin_nam = p->getHbinName();
            printFieldInfo("hbin_nam\0", hbin_nam, rec->getFileRecByteStartPosition());

        }
        break;

    case MIR:
        {
            Mir* pMir = dynamic_cast<Mir*>(rec);
            printHeaderInfo(rec);

            StdfField<long> setupt = pMir->getSetupTime();            
            printFieldInfo("setupt\0", setupt, pMir->getFileRecByteStartPosition(), &Util::convertDtToMysqlDtFormat);

            StdfField<long> startt = pMir->getStartTime();
            printFieldInfo("startt\0", startt, pMir->getFileRecByteStartPosition(), &Util::convertDtToMysqlDtFormat);

            StdfField<int> stat_num = pMir->getStartNum();
            printFieldInfo("stat_num\0", stat_num, pMir->getFileRecByteStartPosition());

            StdfField<string> mod_cod = pMir->getModeCode();
            printFieldInfo("mod_cod\0", mod_cod, pMir->getFileRecByteStartPosition());

            StdfField<string> rtst_cod = pMir->getRetestCode();
            printFieldInfo("rtst_cod\0", rtst_cod, pMir->getFileRecByteStartPosition());

            StdfField<string> prot_cod = pMir->getProductCode();
            printFieldInfo("prot_cod\0", prot_cod, pMir->getFileRecByteStartPosition());

            StdfField<long> burn_tim = pMir->getBurnTime();
            printFieldInfo("burn_tim\0", burn_tim, pMir->getFileRecByteStartPosition());

            StdfField<string> cmod_cod = pMir->getCmodCode();
            printFieldInfo("cmod_cod\0", cmod_cod, pMir->getFileRecByteStartPosition());

            StdfField<string> lot_id = pMir->getLotId();
            printFieldInfo("lot_id\0", lot_id, pMir->getFileRecByteStartPosition());

            StdfField<string> part_typ = pMir->getPartType();
            printFieldInfo("part_typ\0", part_typ, pMir->getFileRecByteStartPosition());

            StdfField<string> node_nam = pMir->getNodeName();
            printFieldInfo("node_nam\0", node_nam, pMir->getFileRecByteStartPosition());

            StdfField<string> tstr_typ = pMir->getTesterType();
            printFieldInfo("tstr_typ\0", tstr_typ, pMir->getFileRecByteStartPosition());

            StdfField<string> job_nam = pMir->getJobName();
            printFieldInfo("job_nam\0", job_nam, pMir->getFileRecByteStartPosition());

            StdfField<string> job_rev = pMir->getJobRevision();
            printFieldInfo("job_rev\0", job_rev, pMir->getFileRecByteStartPosition());

            StdfField<string> sblot_lid = pMir->getSubLotId();
            printFieldInfo("sblot_lid\0", sblot_lid, pMir->getFileRecByteStartPosition());

            StdfField<string> oper_nam = pMir->getOperatorName();
            printFieldInfo("oper_nam\0", oper_nam, pMir->getFileRecByteStartPosition());

            StdfField<string> exec_typ = pMir->getExecutionType();
            printFieldInfo("exec_typ\0", exec_typ, pMir->getFileRecByteStartPosition());

            StdfField<string> exec_ver = pMir->getExecutiveVersion();
            printFieldInfo("exec_ver\0", exec_ver, pMir->getFileRecByteStartPosition());

            StdfField<string> test_cod = pMir->getTestCode();
            printFieldInfo("test_cod\0", test_cod, pMir->getFileRecByteStartPosition());

            StdfField<string> tst_temp = pMir->getTestTemperature();
            printFieldInfo("tst_temp\0", tst_temp, pMir->getFileRecByteStartPosition());

            StdfField<string> user_txt = pMir->getUserText();
            printFieldInfo("user_txt\0", user_txt, pMir->getFileRecByteStartPosition());

            StdfField<string> aux_file = pMir->getAuxilaryFile();
            printFieldInfo("aux_file\0", aux_file, pMir->getFileRecByteStartPosition());

            StdfField<string> pkg_typ = pMir->getPackageType();
            printFieldInfo("pkg_typ\0", pkg_typ, pMir->getFileRecByteStartPosition());

            StdfField<string> family_id = pMir->getFamilyId();
            printFieldInfo("family_id\0", family_id, pMir->getFileRecByteStartPosition());

            StdfField<string> date_cod = pMir->getDateCode();
            printFieldInfo("data_cod\0", date_cod, pMir->getFileRecByteStartPosition());

            StdfField<string> facil_id = pMir->getTestFacilityId();
            printFieldInfo("facil_id\0", facil_id, pMir->getFileRecByteStartPosition());

            StdfField<string> floor_id = pMir->getTestFloorId();
            printFieldInfo("floor_id\0", floor_id, pMir->getFileRecByteStartPosition());

            StdfField<string> proc_id = pMir->getProcessId();
            printFieldInfo("proc_id\0", proc_id, pMir->getFileRecByteStartPosition());

            StdfField<string> oper_frq = pMir->getOperationFrequency();
            printFieldInfo("oper_frq\0", oper_frq, pMir->getFileRecByteStartPosition());

            StdfField<string> spec_nam = pMir->getSpecName();
            printFieldInfo("spec_nam\0", spec_nam, pMir->getFileRecByteStartPosition());

            StdfField<string> spec_ver = pMir->getSpecVersion();
            printFieldInfo("spec_ver\0", spec_ver, pMir->getFileRecByteStartPosition());

            StdfField<string> flow_id = pMir->getFlowId();
            printFieldInfo("flow_id\0", flow_id, pMir->getFileRecByteStartPosition());

            StdfField<string> setup_id = pMir->getSetupId();
            printFieldInfo("setup_id\0", setup_id, pMir->getFileRecByteStartPosition());

            StdfField<string> design_id = pMir->getDesignId();
            printFieldInfo("design_id\0", design_id, pMir->getFileRecByteStartPosition());

            StdfField<string> engrg_id = pMir->getEngrgId();
            printFieldInfo("engrg_id\0", engrg_id, pMir->getFileRecByteStartPosition());

            StdfField<string> rom_cod = pMir->getRomCode();
            printFieldInfo("rom_cod\0", rom_cod, pMir->getFileRecByteStartPosition());

            StdfField<string> serial_num = pMir->getSerialNumber();
            printFieldInfo("serial_num\0", serial_num, pMir->getFileRecByteStartPosition());

            StdfField<string> supr_nam = pMir->getSupervisorName();
            printFieldInfo("supr_nam\0", supr_nam, pMir->getFileRecByteStartPosition());

        }
        break;

    case MPR:
        {
            Mpr* p = dynamic_cast<Mpr*>(rec);
            printHeaderInfo(rec);

            StdfField<long> test_num = p->getTestNumber();
            printFieldInfo("test_num\0", test_num, rec->getFileRecByteStartPosition());

            StdfField<int> head_num = p->getHeadNumber();
            printFieldInfo("head_num\0", head_num, rec->getFileRecByteStartPosition());

            StdfField<int> site_num = p->getSiteNumber();
            printFieldInfo("site_num\0", site_num, rec->getFileRecByteStartPosition());

            StdfField<vector<bool> > test_flag = p->getTestFlag();
            printFieldInfo("test_flag\0", test_flag, rec->getFileRecByteStartPosition());

            StdfField<vector<bool> > parm_flag = p->getParameterFlag();
            printFieldInfo("parm_flag\0", parm_flag, rec->getFileRecByteStartPosition());

            StdfField<int> rtn_icnt = p->getPmrCountIndexes();
            printFieldInfo("rtn_icnt\0", rtn_icnt, rec->getFileRecByteStartPosition());

            StdfField<int> rslt_cnt = p->getReturnResultsCount();
            printFieldInfo("rslt_cnt\0", rslt_cnt, rec->getFileRecByteStartPosition());

            StdfField<vector<int> > rtn_stat = p->getReturnStatesArray();
            printFieldInfo("rtn_stat\0", rtn_stat, rec->getFileRecByteStartPosition());

            StdfField<vector<float> > rtn_rslt = p->getReturnResultsArray();
            printFieldInfo("rtn_rslt\0", rtn_rslt, rec->getFileRecByteStartPosition());

            StdfField<string> test_txt = p->getTestDescriptiveText();
            printFieldInfo("test_txt\0", test_txt, rec->getFileRecByteStartPosition());

            StdfField<string> alrm_id = p->getAlarmId();
            printFieldInfo("alrm_id\0", alrm_id, rec->getFileRecByteStartPosition());

            StdfField<vector<bool> > opt_flag = p->getOptionFlag();
            printFieldInfo("opt_flag\0", opt_flag, rec->getFileRecByteStartPosition());

            StdfField<int> res_scal = p->getTestResultScale();
            printFieldInfo("res_scal\0", res_scal, rec->getFileRecByteStartPosition());

            StdfField<int> llm_scal = p->getTestLowerLimitScale();
            printFieldInfo("llm_scal\0", llm_scal, rec->getFileRecByteStartPosition());

            StdfField<int> hlm_scal = p->getTestUpperLimitScale();
            printFieldInfo("hlm_scal\0", hlm_scal, rec->getFileRecByteStartPosition());

            StdfField<float> lo_limit = p->getTestLowerLimitValue();
            printFieldInfo("lo_limit\0", lo_limit, rec->getFileRecByteStartPosition());

            StdfField<float> hi_limit = p->getTestUpperLimitValue();
            printFieldInfo("hi_limit\0", hi_limit, rec->getFileRecByteStartPosition());

            StdfField<float> start_in = p->getStartingInValue();
            printFieldInfo("start_in\0", start_in, rec->getFileRecByteStartPosition());

            StdfField<float> incr_in = p->getStartingIncrementalValue();
            printFieldInfo("incr_in\0", incr_in, rec->getFileRecByteStartPosition());

            StdfField<vector<unsigned int> > rtn_indx = p->getPmrIndexArray();
            printFieldInfo("rtn_indx\0", rtn_indx, rec->getFileRecByteStartPosition());

            StdfField<string> units = p->getUnits();
            printFieldInfo("units\0", units, rec->getFileRecByteStartPosition());

            StdfField<string> units_in = p->getInputConditionUnits();
            printFieldInfo("units_in\0", units_in, rec->getFileRecByteStartPosition());

            StdfField<string> c_resfmt = p->getResultFormat();
            printFieldInfo("c_resfmt\0", c_resfmt, rec->getFileRecByteStartPosition());

            StdfField<string> c_llmfmt = p->getLowerLimitFormat();
            printFieldInfo("c_llmfmt\0", c_llmfmt, rec->getFileRecByteStartPosition());

            StdfField<string> c_hlmfmt = p->getUpperLimitFormat();
            printFieldInfo("c_hlmfmt\0", c_hlmfmt, rec->getFileRecByteStartPosition());

            StdfField<float> lo_spec = p->getLowerSpecLimit();
            printFieldInfo("lo_spec\0", lo_spec, rec->getFileRecByteStartPosition());

            StdfField<float> hi_spec = p->getUpperSpecLimit();
            printFieldInfo("hi_spec\0", hi_spec, rec->getFileRecByteStartPosition());


        }
        break;

    case MRR:
        {
            Mrr* p = dynamic_cast<Mrr*>(rec);
            printHeaderInfo(rec);

            StdfField<long> finish_t = p->getFinishTime();
            printFieldInfo("finish_t\0", finish_t, rec->getFileRecByteStartPosition(), &Util::convertDtToMysqlDtFormat);

            StdfField<string> disp_cod = p->getDispCode();
            printFieldInfo("disp_cod\0", disp_cod, rec->getFileRecByteStartPosition());

            StdfField<string> usr_desc = p->getUserDescription();
            printFieldInfo("usr_desc\0", usr_desc, rec->getFileRecByteStartPosition());

            StdfField<string> exc_desc = p->getExecDescription();
            printFieldInfo("exc_desc\0", exc_desc, rec->getFileRecByteStartPosition());

        }
        break;

    case PCR:
        {
            Pcr* p = dynamic_cast<Pcr*>(rec);
            printHeaderInfo(rec);

            StdfField<int> head_num = p->getHeadNum();
            printFieldInfo("head_num\0", head_num, rec->getFileRecByteStartPosition());

            StdfField<int> site_num = p->getSiteNum();
            printFieldInfo("site_num\0", site_num, rec->getFileRecByteStartPosition());

            StdfField<long> part_cnt = p->getPartCount();
            printFieldInfo("part_cnt\0", part_cnt, rec->getFileRecByteStartPosition());

            StdfField<long> rtst_cnt = p->getRetestCount();
            printFieldInfo("rtst_cnt\0", rtst_cnt, rec->getFileRecByteStartPosition());

            StdfField<long> abrt_cnt = p->getAbortCount();
            printFieldInfo("abrt_cnt\0", abrt_cnt, rec->getFileRecByteStartPosition());

            StdfField<long> good_cnt = p->getGoodCount();
            printFieldInfo("good_cnt\0", good_cnt, rec->getFileRecByteStartPosition());

            StdfField<long> func_cnt = p->getFunctionalCount();
            printFieldInfo("func_cnt\0", func_cnt, rec->getFileRecByteStartPosition());


        }
        break;

    case PGR:
        {
            Pgr* p = dynamic_cast<Pgr*>(rec);
            printHeaderInfo(rec);

            StdfField<int> grp_indx = p->getGroupIndex();
            printFieldInfo("grp_indx\0", grp_indx, rec->getFileRecByteStartPosition());

            StdfField<string> grp_nam = p->getGroupName();
            printFieldInfo("grp_nam\0", grp_nam, rec->getFileRecByteStartPosition());

            StdfField<int> indx_cnt = p->getIndexCount();
            printFieldInfo("indx_cnt\0", indx_cnt, rec->getFileRecByteStartPosition());

            StdfField<vector<unsigned int> > pmr_indx = p->getPinIndexArray();
            printFieldInfo("pmr_indx\0", pmr_indx, rec->getFileRecByteStartPosition());

        }
        break;

    case PIR:
        {
            Pir* p = dynamic_cast<Pir*>(rec);
            printHeaderInfo(rec);

            StdfField<int> head_num = p->getHeadNum();
            printFieldInfo("head_num\0", head_num, rec->getFileRecByteStartPosition());

            StdfField<int> site_num = p->getSiteNum();
            printFieldInfo("site_num\0", site_num, rec->getFileRecByteStartPosition());


        }
        break;

    case PLR:
        {
            Plr* p = dynamic_cast<Plr*>(rec);
            printHeaderInfo(rec);

            StdfField<int> grp_cnt = p->getGroupCount();
            printFieldInfo("grp_cnt\0", grp_cnt, rec->getFileRecByteStartPosition());

            StdfField<vector<unsigned int> > grp_indx = p->getGroupIndex();
            printFieldInfo("grp_indx\0", grp_indx, rec->getFileRecByteStartPosition());

            StdfField<vector<unsigned int> > grp_mode = p->getGroupMode();
            printFieldInfo("grp_mode\0", grp_mode, rec->getFileRecByteStartPosition());

            StdfField<vector<unsigned int> > grp_radx = p->getGroupDisplayRadix();
            printFieldInfo("grp_radx\0", grp_radx, rec->getFileRecByteStartPosition());

            StdfField<vector<string> > pgm_char = p->getProgramStateEncodeChars();
            printFieldInfo("pgm_char\0", pgm_char, rec->getFileRecByteStartPosition());

            StdfField<vector<string> > rtn_char = p->getReturnStateStateEncodeChars();
            printFieldInfo("rtn_char\0", rtn_char, rec->getFileRecByteStartPosition());

            StdfField<vector<string> > pgm_chal = p->getProgramStateStateEncodeCharsL();
            printFieldInfo("pgm_chal\0", pgm_chal, rec->getFileRecByteStartPosition());

            StdfField<vector<string> > rtn_chal = p->getReturnStateStateEncodeCharsL();
            printFieldInfo("rtn_chal\0", rtn_chal, rec->getFileRecByteStartPosition());

        }
        break;

    case PMR:
        {
            Pmr* p = dynamic_cast<Pmr*>(rec);
            printHeaderInfo(rec);

            StdfField<int> pmr_indx = p->getUniquePinIndex();
            printFieldInfo("pmr_indx\0", pmr_indx, rec->getFileRecByteStartPosition());

            StdfField<int> chan_typ = p->getChannelType();
            printFieldInfo("chan_typ\0", chan_typ, rec->getFileRecByteStartPosition());

            StdfField<string> chan_nam = p->getChannelName();
            printFieldInfo("chan_nam\0", chan_nam, rec->getFileRecByteStartPosition());

            StdfField<string> phy_nam = p->getPhysicalPinName();
            printFieldInfo("phy_nam\0", phy_nam, rec->getFileRecByteStartPosition());

            StdfField<string> log_nam = p->getLogicalPinName();
            printFieldInfo("log_nam\0", log_nam, rec->getFileRecByteStartPosition());

            StdfField<int> head_num = p->getHeadNum();
            printFieldInfo("head_num\0", head_num, rec->getFileRecByteStartPosition());

            StdfField<int> site_num = p->getSiteNum();
            printFieldInfo("site_num\0", site_num, rec->getFileRecByteStartPosition());

        }
        break;

    case PRR:
        {
            Prr* p = dynamic_cast<Prr*>(rec);
            printHeaderInfo(rec);

            StdfField<int> head_num = p->getHeadNumber();
            printFieldInfo("head_num\0", head_num, rec->getFileRecByteStartPosition());

            StdfField<int> site_num = p->getSiteNumber();
            printFieldInfo("site_num\0", site_num, rec->getFileRecByteStartPosition());

            StdfField<vector<bool> > part_flag = p->getPartFlag();
            printFieldInfo("part_flag\0", part_flag, rec->getFileRecByteStartPosition());

            StdfField<int> num_test = p->getNumberOfTests();
            printFieldInfo("num_test\0", num_test, rec->getFileRecByteStartPosition());

            StdfField<int> hard_bin = p->getHardBin();
            printFieldInfo("hard_bin\0", hard_bin, rec->getFileRecByteStartPosition());

            StdfField<int> soft_bin = p->getSoftBin();
            printFieldInfo("soft_bin\0", soft_bin, rec->getFileRecByteStartPosition());

            StdfField<int> x_coord = p->getXCoordinate();
            printFieldInfo("x_coord\0", x_coord, rec->getFileRecByteStartPosition());

            StdfField<int> y_coord = p->getYCoordinate();
            printFieldInfo("y_coord\0", y_coord, rec->getFileRecByteStartPosition());

            StdfField<long> test_t = p->getTestTime();
            printFieldInfo("test_t\0", test_t, rec->getFileRecByteStartPosition(), &Util::convertDtToMysqlDtFormat);

            StdfField<string> part_id = p->getPartId();
            printFieldInfo("part_id\0", part_id, rec->getFileRecByteStartPosition());

            StdfField<string> part_txt = p->getPartText();
            printFieldInfo("part_txt\0", part_txt, rec->getFileRecByteStartPosition());

            StdfField<CharArray> part_fix = p->getPartFix();
            printFieldInfo("part_fix\0", part_fix, rec->getFileRecByteStartPosition());

        }
        break;

    case PTR:
        {
            Ptr* p = dynamic_cast<Ptr*>(rec);
            printHeaderInfo(rec);

            StdfField<long> test_num = p->getTestNumber();
            printFieldInfo("test_num\0", test_num, rec->getFileRecByteStartPosition());

            StdfField<int> head_num = p->getHeadNumber();
            printFieldInfo("head_num\0", head_num, rec->getFileRecByteStartPosition());

            StdfField<int> site_num = p->getSiteNumber();
            printFieldInfo("site_num\0", site_num, rec->getFileRecByteStartPosition());


            StdfField<vector<bool> > test_flag = p->getTestFlag();
            printFieldInfo("test_flag\0", test_flag, rec->getFileRecByteStartPosition());

            StdfField<vector<bool> >  paratest_flag = p->getParaTestFlag();
            printFieldInfo("paratest_flag\0", paratest_flag, rec->getFileRecByteStartPosition());

            StdfField<float> result = p->getResult();
            printFieldInfo("result\0", result, rec->getFileRecByteStartPosition());

            StdfField<string> test_txt = p->getTestText();
            printFieldInfo("test_txt\0", test_txt, rec->getFileRecByteStartPosition());

            StdfField<string> alrm_id = p->getAlarmId();
            printFieldInfo("alrm_id\0", alrm_id, rec->getFileRecByteStartPosition());

            StdfField<vector<bool> > opt_flag = p->getOptionFlag();
            printFieldInfo("opt_flag\0", opt_flag, rec->getFileRecByteStartPosition());

            StdfField<int> result_scal = p->getResultScale();
            printFieldInfo("result_scal\0", result_scal, rec->getFileRecByteStartPosition());

            StdfField<int> lwlimit_scal = p->getLowerLimitScale();
            printFieldInfo("lwlimit_scal\0", lwlimit_scal, rec->getFileRecByteStartPosition());

            StdfField<int> uplimit_scal  = p->getUpperLimitScale();
            printFieldInfo("uplimit_scal\0", uplimit_scal, rec->getFileRecByteStartPosition());

            StdfField<float> lowtestlimit_val = p->getLowerTestLimitValue();
            printFieldInfo("lowtestlimit_val\0", lowtestlimit_val, rec->getFileRecByteStartPosition());

            StdfField<float> hightestlimit_val = p->getUpperTestLimitValue();
            printFieldInfo("hightestlimit_val\0",hightestlimit_val, rec->getFileRecByteStartPosition());

            StdfField<string> res_units = p->getResultsUnit();
            printFieldInfo("res_units\0", res_units, rec->getFileRecByteStartPosition());

            StdfField<string> result_fmt = p->getResultFormat();
            printFieldInfo("result_fmt\0", result_fmt, rec->getFileRecByteStartPosition());

            StdfField<string> lwlimit_scal_fmt = p->getLowerLimitScaleFormat();
            printFieldInfo("lwlimit_scal_fmt\0", lwlimit_scal_fmt, rec->getFileRecByteStartPosition());

            StdfField<string> uplimit_scal_fmt = p->getUpperLimitScaleFormat();
            printFieldInfo("uplimit_scal_fmt\0", uplimit_scal_fmt, rec->getFileRecByteStartPosition());

            StdfField<float> lwlimit_spec = p->getLowerLimitSpec();
            printFieldInfo("lwlimit_spec\0", lwlimit_spec, rec->getFileRecByteStartPosition());

            StdfField<float> uplimit_spec = p->getUpperLimitSpec();
            printFieldInfo("uplimit_spec\0", uplimit_spec, rec->getFileRecByteStartPosition());

        }
        break;

    case RDR:
        {
            Rdr* p = dynamic_cast<Rdr*>(rec);
            printHeaderInfo(rec);

            StdfField<int> num_bins = p->getRetestBinCount();
            printFieldInfo("num_bins\0", num_bins, rec->getFileRecByteStartPosition());

            StdfField<vector<unsigned int> > rtst_bin = p->getRetestBinNumber();
            printFieldInfo("rtst_bin\0", rtst_bin, rec->getFileRecByteStartPosition());

        }
        break;

    case SBR:
        {
            Sbr* p = dynamic_cast<Sbr*>(rec);
            printHeaderInfo(rec);

            StdfField<int> head_num = p->getHeadNum();
            printFieldInfo("head_num\0", head_num, rec->getFileRecByteStartPosition());

            StdfField<int> site_num = p->getSiteNum();
            printFieldInfo("site_num\0", site_num, rec->getFileRecByteStartPosition());

            StdfField<int> sbin_num = p->getSbinNum();
            printFieldInfo("sbin_num\0", sbin_num, rec->getFileRecByteStartPosition());

            StdfField<long> sbin_cnt = p->getSbinCount();
            printFieldInfo("sbin_cnt\0", sbin_cnt, rec->getFileRecByteStartPosition());

            StdfField<string> sbin_pf  = p->getSbinPassFail();
            printFieldInfo("sbin_pf\0", sbin_pf, rec->getFileRecByteStartPosition());

            StdfField<string> sbin_nam = p->getSbinName();
            printFieldInfo("sbin_nam\0", sbin_nam, rec->getFileRecByteStartPosition());

        }
        break;

    case SDR:
        {
            Sdr* p = dynamic_cast<Sdr*>(rec);
            printHeaderInfo(p);

            StdfField<int> head_num = p->getHeadNum();
            printFieldInfo("head_num\0", head_num, p->getFileRecByteStartPosition());

            StdfField<int> site_grp = p->getSiteGroup();
            printFieldInfo("site_grp\0", site_grp, p->getFileRecByteStartPosition());

            StdfField<int> site_cnt = p->getSiteCount();
            printFieldInfo("site_cnt\0", site_cnt, p->getFileRecByteStartPosition());

            StdfField<vector<unsigned int> > site_num = p->getSiteNum();
            printFieldInfo("site_num\0", site_num, p->getFileRecByteStartPosition());

            StdfField<string> hand_typ = p->getHandlerType();
            printFieldInfo("hand_typ\0", hand_typ, p->getFileRecByteStartPosition());

            StdfField<string> hand_id = p->getHandlerId();
            printFieldInfo("hand_id\0", hand_id, p->getFileRecByteStartPosition());

            StdfField<string> card_typ = p->getProbeCardType();
            printFieldInfo("card_typ\0", card_typ, p->getFileRecByteStartPosition());

            StdfField<string> card_id = p->getProbeCardId();
            printFieldInfo("card_id\0", card_id, p->getFileRecByteStartPosition());

            StdfField<string> load_typ = p->getLoadBoardType();
            printFieldInfo("load_typ\0", load_typ, p->getFileRecByteStartPosition());

            StdfField<string> load_id = p->getLoadBoardId();
            printFieldInfo("load_id\0", load_id, p->getFileRecByteStartPosition());

            StdfField<string> dib_typ = p->getDibBoardId();
            printFieldInfo("dib_typ\0", dib_typ, p->getFileRecByteStartPosition());

            StdfField<string> dib_id = p->getDibBoardType();
            printFieldInfo("dib_id\0", dib_id, p->getFileRecByteStartPosition());

            StdfField<string> cabl_typ = p->getCableType();
            printFieldInfo("cabl_typ\0", cabl_typ, p->getFileRecByteStartPosition());

            StdfField<string> cabl_id = p->getCableId();
            printFieldInfo("cabl_id\0", cabl_id, p->getFileRecByteStartPosition());

            StdfField<string> cont_typ = p->getContactorType();
            printFieldInfo("cont_typ\0", cont_typ, p->getFileRecByteStartPosition());

            StdfField<string> cont_id = p->getContactorId();
            printFieldInfo("cont_id\0", cont_id, p->getFileRecByteStartPosition());

            StdfField<string> lasr_typ = p->getLaserType();
            printFieldInfo("lasr_typ\0", lasr_typ, p->getFileRecByteStartPosition());

            StdfField<string> lasr_id = p->getLaserId();
            printFieldInfo("lasr_id\0", lasr_id, p->getFileRecByteStartPosition());

            StdfField<string> extr_typ = p->getExtraEqptType();
            printFieldInfo("extr_typ\0", extr_typ, p->getFileRecByteStartPosition());

            StdfField<string> extr_id = p->getExtraEqptId();
            printFieldInfo("extr_id\0", extr_id, p->getFileRecByteStartPosition());

        }
        break;

    case TSR:
        {
            Tsr* p = dynamic_cast<Tsr*>(rec);
            printHeaderInfo(rec);

            StdfField<int> head_num = p->getHeadNumber();
            printFieldInfo("head_num\0", head_num, rec->getFileRecByteStartPosition());

            StdfField<int> site_num = p->getSiteNumber();
            printFieldInfo("site_num\0", site_num, rec->getFileRecByteStartPosition());

            StdfField<string> test_typ = p->getTestType();
            printFieldInfo("test_typ\0", test_typ, rec->getFileRecByteStartPosition());

            StdfField<int> test_num = p->getTestNumber();
            printFieldInfo("test_num\0", test_num, rec->getFileRecByteStartPosition());

            StdfField<long> exec_cnt = p->getExecutionCount();
            printFieldInfo("exec_cnt\0", exec_cnt, rec->getFileRecByteStartPosition());

            StdfField<long> fail_cnt = p->getFailureCount();
            printFieldInfo("fail_cnt\0", fail_cnt, rec->getFileRecByteStartPosition());

            StdfField<long> alrm_cnt = p->getAlarmCount();
            printFieldInfo("alrm_cnt\0", alrm_cnt, rec->getFileRecByteStartPosition());

            StdfField<string> test_nam = p->getTestName();
            printFieldInfo("test_nam\0", test_nam, rec->getFileRecByteStartPosition());

            StdfField<string> seq_nam = p->getSequenceName();
            printFieldInfo("seq_nam\0", seq_nam, rec->getFileRecByteStartPosition());

            StdfField<string> test_lbl = p->getTestLabel();
            printFieldInfo("test_lbl\0", test_lbl, rec->getFileRecByteStartPosition());

            StdfField<vector<bool> > opt_flag = p->getOptionFlag();
            printFieldInfo("opt_flag\0", opt_flag, rec->getFileRecByteStartPosition());

            StdfField<float> test_tim = p->getTestTime();
            printFieldInfo("test_tim\0", test_tim, rec->getFileRecByteStartPosition());

            StdfField<float> test_min = p->getLowestTestValue();
            printFieldInfo("test_min\0", test_min, rec->getFileRecByteStartPosition());

            StdfField<float> test_max = p->getHighestTestValue();
            printFieldInfo("test_max\0", test_max, rec->getFileRecByteStartPosition());

            StdfField<float> test_sum = p->getTestResultSumValue();
            printFieldInfo("test_sum\0", test_sum, rec->getFileRecByteStartPosition());

            StdfField<float> test_sqrs = p->getTestResultSquareValue();
            printFieldInfo("test_sqrs\0", test_sqrs, rec->getFileRecByteStartPosition());

        }
        break;

    case WCR:
        {
            Wcr* p = dynamic_cast<Wcr*>(rec);
            printHeaderInfo(rec);

            StdfField<float> wfr_siz = p->getWaferSize();
            printFieldInfo("wfr_siz\0", wfr_siz, rec->getFileRecByteStartPosition());

            StdfField<float> die_ht = p->getDieHeight();
            printFieldInfo("die_ht\0", die_ht, rec->getFileRecByteStartPosition());

            StdfField<float> die_wid = p->getDieWidth();
            printFieldInfo("die_wid\0", die_wid, rec->getFileRecByteStartPosition());

            StdfField<int> wfr_unit = p->getWaferUnit();
            printFieldInfo("wfr_unit\0", wfr_unit, rec->getFileRecByteStartPosition());

            StdfField<string> wfr_flat = p->getWaferFlat();
            printFieldInfo("wfr_flat\0", wfr_flat, rec->getFileRecByteStartPosition());

            StdfField<int> center_x = p->getCenterX();
            printFieldInfo("center_x\0", center_x, rec->getFileRecByteStartPosition());

            StdfField<int> center_y = p->getCenterY();
            printFieldInfo("center_y\0", center_y, rec->getFileRecByteStartPosition());

            StdfField<string> pos_x = p->getPositionX();
            printFieldInfo("pos_x\0", pos_x, rec->getFileRecByteStartPosition());

            StdfField<string> pos_y = p->getPositionY();
            printFieldInfo("pos_y\0", pos_y, rec->getFileRecByteStartPosition());

        }
        break;

    case WIR:
        {
            Wir* p = dynamic_cast<Wir*>(rec);
            printHeaderInfo(rec);

            StdfField<int> head_num = p->getHeadNum();
            printFieldInfo("head_num\0", head_num, rec->getFileRecByteStartPosition());

            StdfField<int> site_grp = p->getSiteGroup();
            printFieldInfo("site_grp\0", site_grp, rec->getFileRecByteStartPosition());

            StdfField<long> start_t = p->getStartTime();
            printFieldInfo("start_t\0", start_t, rec->getFileRecByteStartPosition());

            StdfField<string> wafer_id = p->getWaferId();
            printFieldInfo("wafer_id\0", wafer_id, rec->getFileRecByteStartPosition());

        }
        break;

    case WRR:
        {
            Wrr* p = dynamic_cast<Wrr*>(rec);
            printHeaderInfo(rec);

            StdfField<int> head_num = p->getHeadNum();
            printFieldInfo("head_num\0", head_num, rec->getFileRecByteStartPosition());

            StdfField<int> site_grp = p->getSiteGroup();
            printFieldInfo("site_grp\0", site_grp, rec->getFileRecByteStartPosition());

            StdfField<long> finish_t = p->getFinishTime();
            printFieldInfo("finish_t\0", finish_t, rec->getFileRecByteStartPosition(), &Util::convertDtToMysqlDtFormat);

            StdfField<long> part_cnt = p->getPartCount();
            printFieldInfo("part_cnt\0", part_cnt, rec->getFileRecByteStartPosition());

            StdfField<long> rtst_cnt= p->getRetestCount();
            printFieldInfo("rtst_cnt\0", rtst_cnt, rec->getFileRecByteStartPosition());

            StdfField<long> abrt_cnt = p->getAbortCount();
            printFieldInfo("abrt_cnt\0", abrt_cnt, rec->getFileRecByteStartPosition());

            StdfField<long> good_cnt = p->getGoodCount();
            printFieldInfo("good_cnt\0", good_cnt, rec->getFileRecByteStartPosition());

            StdfField<long> func_cnt = p->getFunctionalCount();
            printFieldInfo("func_cnt\0", func_cnt, rec->getFileRecByteStartPosition());

            StdfField<string> wafer_id = p->getWaferId();
            printFieldInfo("wafer_id\0", wafer_id, rec->getFileRecByteStartPosition());

            StdfField<string> fabwf_id = p->getFabWaferId();
            printFieldInfo("fabwf_id\0", fabwf_id, rec->getFileRecByteStartPosition());

            StdfField<string> frame_id = p->getFrameId();
            printFieldInfo("frame_id\0", frame_id, rec->getFileRecByteStartPosition());

            StdfField<string> mask_id = p->getMaskId();
            printFieldInfo("mask_id\0", mask_id, rec->getFileRecByteStartPosition());

            StdfField<string> usr_desc = p->getUserDescription();
            printFieldInfo("usr_desc\0", usr_desc, rec->getFileRecByteStartPosition());

            StdfField<string> excr_desc = p->getExecDescription();
            printFieldInfo("excr_desc\0", excr_desc, rec->getFileRecByteStartPosition());


        }
        break;

    case UNK:
        // do nothing
        break;

    default:
        break;

    }
}

void DebugPrintDetail::printHeaderInfo(RecBase* rec) {
    const char* nm = StdfHelp::getStdfFieldStringName(rec->getStdfRec());
    cout << nm ;
    cout << tab1 << "rec-order : " << rec->getRecOrder() << endl;
    cout << tab1 << "file-byte-start-position : " << rec->getFileRecByteStartPosition() << endl;
    cout << tab1 << "file-byte-end-position : " << ( rec->getFileRecByteStartPosition() + rec->getRecByteCount() + 4 -1 )  << endl;
    cout << tab1 << "rec-total-byte-count : " << (rec->getRecByteCount() + 4) << endl;
    cout << tab1 << "rec-data-byte-count : " << rec->getRecByteCount() << endl;

}


void DebugPrintDetail::printFieldInfo(const char* name, StdfField<unsigned int>& f, long stdfRecStartBytePosition) {
    string nm(name);
    if (f.getTotalByteCount()== 0) {
        cout << tab1 << nm << " (nil) " << endl;
        return;
    }
    cout << tab1 << nm << endl;
    cout << tab2 << "file-byte-start-position : " << (stdfRecStartBytePosition + 4 +  f.getOffset() ) << endl;
    cout << tab2 << "offset : " << f.getOffset() << endl;
    cout << tab2 << "total-byte-count : " << f.getTotalByteCount() << endl;
    cout << tab2 << "data-byte-count : " << f.getByteCount() << endl;
    cout << tab2 << "data-value : " << f.getData() << endl;

}

void DebugPrintDetail::printFieldInfo(const char* name, StdfField<int>& f, long stdfRecStartBytePosition) {
    string nm(name);
    if (f.getTotalByteCount()== 0) {
        cout << tab1 << nm << " (nil) " << endl;
        return;
    }
    cout << tab1 << nm << endl;
    cout << tab2 << "file-byte-start-position : " << (stdfRecStartBytePosition + 4 +  f.getOffset() ) << endl;
    cout << tab2 << "offset : " << f.getOffset() << endl;
    cout << tab2 << "total-byte-count : " << f.getTotalByteCount() << endl;
    cout << tab2 << "data-byte-count : " << f.getByteCount() << endl;
    cout << tab2 << "data-value : " << f.getData() << endl;
}


void DebugPrintDetail::printFieldInfo(const char* name, StdfField<string>& f, long stdfRecStartBytePosition) {
    string nm(name);
    if (f.getTotalByteCount()== 0) {
        cout << tab1 << nm << " (nil) " << endl;
        return;
    }
    cout << tab1 << nm << endl;
    cout << tab2 << "file-byte-start-position : " << (stdfRecStartBytePosition + 4 +  f.getOffset() ) << endl;
    cout << tab2 << "offset : " << f.getOffset() << endl;
    cout << tab2 << "total-byte-count : " << f.getTotalByteCount() << endl;
    cout << tab2 << "data-byte-count : " << f.getByteCount() << endl;
    cout << tab2 << "data-value : " << f.getData() << endl;
}

void DebugPrintDetail::printFieldInfo(const char* name, StdfField<unsigned long>& f, long stdfRecStartBytePosition) {
    string nm(name);
    if (f.getTotalByteCount()== 0) {
        cout << tab1 << nm << " (nil) " << endl;
        return;
    }
    cout << tab1 << nm << endl;
    cout << tab2 << "file-byte-start-position : " << (stdfRecStartBytePosition + 4 +  f.getOffset() ) << endl;
    cout << tab2 << "offset : " << f.getOffset() << endl;
    cout << tab2 << "total-byte-count : " << f.getTotalByteCount() << endl;
    cout << tab2 << "data-byte-count : " << f.getByteCount() << endl;
    cout << tab2 << "data-value : " << f.getData() << endl;
}


void DebugPrintDetail::printFieldInfo(const char* name, StdfField<long>& f, long stdfRecStartBytePosition) {
    string nm(name);
    if (f.getTotalByteCount()== 0) {
        cout << tab1 << nm << " (nil) " << endl;
        return;
    }
    cout << tab1 << nm << endl;
    cout << tab2 << "file-byte-start-position : " << (stdfRecStartBytePosition + 4 +  f.getOffset() ) << endl;
    cout << tab2 << "offset : " << f.getOffset() << endl;
    cout << tab2 << "total-byte-count : " << f.getTotalByteCount() << endl;
    cout << tab2 << "data-byte-count : " << f.getByteCount() << endl;
    cout << tab2 << "data-value : " << f.getData() << endl;
}

void DebugPrintDetail::printFieldInfo(const char* name, StdfField<float>& f, long stdfRecStartBytePosition) {
    string nm(name);
    if (f.getTotalByteCount()== 0) {
        cout << tab1 << nm << " (nil) " << endl;
        return;
    }
    cout << tab1 << nm << endl;
    cout << tab2 << "file-byte-start-position : " << (stdfRecStartBytePosition + 4 +  f.getOffset() ) << endl;
    cout << tab2 << "offset : " << f.getOffset() << endl;
    cout << tab2 << "total-byte-count : " << f.getTotalByteCount() << endl;
    cout << tab2 << "data-byte-count : " << f.getByteCount() << endl;
    cout << tab2 << "data-value : " << f.getData() << endl;
}


void DebugPrintDetail::out(string& msg) {
    cout << msg  ;
}

void DebugPrintDetail::out(const char* msg) {

    cout << msg ;
}

void DebugPrintDetail::out(int value) {
    std::stringstream out;
    out << value;
    cout << out.str() ;

}

void DebugPrintDetail::out(float value) {
    std::stringstream out;
    out << value;
    cout << out.str() ;
    cout << endl;
}

void DebugPrintDetail::out(long value) {
    std::stringstream out;
    out << value;
    cout << out.str() ;
    cout << endl;
}


void DebugPrintDetail::open() {

}

void DebugPrintDetail::close() {

}


void DebugPrintDetail::printFieldInfo(const char* name, StdfField<vector<bool> >& f, long stdfRecStartBytePosition) {
    string nm(name);
    if (f.getTotalByteCount()== 0) {
        cout << tab1 << nm << " (nil) " << endl;
        return;
    }

    vector<bool> arr = f.getData();
    string data = "";
    std::stringstream out;

    if ((int)arr.size()>0) {

        vector<bool>::const_iterator it;
        for (it=arr.begin(); it!=arr.end();it++) {
            out << (*it? 1: 0 );
            if (it != arr.end()-1)
               out << listsep;
        }
        data += out.str();
    }



    cout << tab1 << nm << endl;
    cout << tab2 << "file-byte-start-position : " << (stdfRecStartBytePosition + 4 +  f.getOffset() ) << endl;
    cout << tab2 << "offset : " << f.getOffset() << endl;
    cout << tab2 << "total-byte-count : " << f.getTotalByteCount() << endl;
    cout << tab2 << "data-byte-count : " << f.getByteCount() << endl;
    cout << tab2 << "data-value : " << data << endl;
}



void DebugPrintDetail::printFieldInfo(const char* name, StdfField<vector<int> >& f, long stdfRecStartBytePosition) {
    string nm(name);
    if (f.getTotalByteCount()== 0) {
        cout << tab1 << nm << " (nil) " << endl;
        return;
    }

    vector<int> arr = f.getData();
    string data = "";
    std::stringstream out;

    if ((int)arr.size()>0) {

        vector<int>::const_iterator it;
        for (it=arr.begin(); it!=arr.end();it++) {
            out << *it;
            if (it != arr.end()-1)
               out << listsep;
        }
        data += out.str();
    }

    cout << tab1 << nm << endl;
    cout << tab2 << "file-byte-start-position : " << (stdfRecStartBytePosition + 4 +  f.getOffset() ) << endl;
    cout << tab2 << "offset : " << f.getOffset() << endl;
    cout << tab2 << "total-byte-count : " << f.getTotalByteCount() << endl;
    cout << tab2 << "data-byte-count : " << f.getByteCount() << endl;
    cout << tab2 << "data-value : " << data << endl;
}


void DebugPrintDetail::printFieldInfo(const char* name, StdfField<vector<unsigned int> >& f, long stdfRecStartBytePosition) {
    string nm(name);
    if (f.getTotalByteCount()== 0) {
        cout << tab1 << nm << " (nil) " << endl;
        return;
    }

    vector<unsigned int> arr = f.getData();
    string data = "";
    std::stringstream out;

    if ((int)arr.size()>0) {

        vector<unsigned int>::const_iterator it;
        for (it=arr.begin(); it!=arr.end();it++) {
            out << *it;
            if (it != arr.end()-1)
               out << listsep;
        }
        data += out.str();
    }

    cout << tab1 << nm << endl;
    cout << tab2 << "file-byte-start-position : " << (stdfRecStartBytePosition + 4 +  f.getOffset() ) << endl;
    cout << tab2 << "offset : " << f.getOffset() << endl;
    cout << tab2 << "total-byte-count : " << f.getTotalByteCount() << endl;
    cout << tab2 << "data-byte-count : " << f.getByteCount() << endl;
    cout << tab2 << "data-value : " << data << endl;
}



void DebugPrintDetail::printFieldInfo(const char* name, StdfField<vector<string> >& f, long stdfRecStartBytePosition) {
    string nm(name);
    if (f.getTotalByteCount()== 0) {
        cout << tab1 << nm << " (nil) " << endl;
        return;
    }

    vector<string> arr = f.getData();
    string data = "";

    if ((int)arr.size()>0) {

        vector<string>::const_iterator it;
        for (it=arr.begin(); it!=arr.end();it++) {
            data += *it;
            if (it != arr.end()-1)
               data += listsep;
        }

    }

    cout << tab1 << nm << endl;
    cout << tab2 << "file-byte-start-position : " << (stdfRecStartBytePosition + 4 +  f.getOffset() ) << endl;
    cout << tab2 << "offset : " << f.getOffset() << endl;
    cout << tab2 << "total-byte-count : " << f.getTotalByteCount() << endl;
    cout << tab2 << "data-byte-count : " << f.getByteCount() << endl;
    cout << tab2 << "data-value : " << data << endl;
}

void DebugPrintDetail::printFieldInfo(const char* name, StdfField<vector<float> >& f, long stdfRecStartBytePosition) {
    string nm(name);
    if (f.getTotalByteCount()== 0) {
        cout << tab1 << nm << " (nil) " << endl;
        return;
    }

    vector<float> arr = f.getData();
    string data = "";
    std::stringstream out;

    if ((int)arr.size()>0) {

        vector<float>::const_iterator it;
        for (it=arr.begin(); it!=arr.end();it++) {
            out << *it;
            if (it != arr.end()-1)
               out << listsep;
        }
        data += out.str();
    }

    cout << tab1 << nm << endl;
    cout << tab2 << "file-byte-start-position : " << (stdfRecStartBytePosition + 4 +  f.getOffset() ) << endl;
    cout << tab2 << "offset : " << f.getOffset() << endl;
    cout << tab2 << "total-byte-count : " << f.getTotalByteCount() << endl;
    cout << tab2 << "data-byte-count : " << f.getByteCount() << endl;
    cout << tab2 << "data-value : " << data << endl;
}


void DebugPrintDetail::printFieldInfo(const char* name, StdfField<CharArray>& f, long stdfRecStartBytePosition) {
    string nm(name);
    if (f.getTotalByteCount()== 0) {
        cout << tab1 << nm << " (nil) " << endl;
        return;
    }

    string data = "";

    cout << tab1 << nm << endl;
    cout << tab2 << "file-byte-start-position : " << (stdfRecStartBytePosition + 4 +  f.getOffset() ) << endl;
    cout << tab2 << "offset : " << f.getOffset() << endl;
    cout << tab2 << "total-byte-count : " << f.getTotalByteCount() << endl;
    cout << tab2 << "data-byte-count : " << f.getByteCount() << endl;
    cout << tab2 << "data-value : " << data << endl;
}

void DebugPrintDetail::printFieldInfo(const char* name, StdfField<long>& f, long stdfRecStartBytePosition, string (*pfunct)( long)  ) {
    string nm(name);
    if (f.getTotalByteCount()== 0) {
        cout << tab1 << nm << " (nil) " << endl;
        return;
    }
    cout << tab1 << nm << endl;
    cout << tab2 << "file-byte-start-position : " << (stdfRecStartBytePosition + 4 +  f.getOffset() ) << endl;
    cout << tab2 << "offset : " << f.getOffset() << endl;
    cout << tab2 << "total-byte-count : " << f.getTotalByteCount() << endl;
    cout << tab2 << "data-byte-count : " << f.getByteCount() << endl;
    cout << tab2 << "data-value : " << f.getData() << endl;
    cout << tab2 << "date-value : " << (*pfunct)(f.getData()) << endl;

}

void DebugPrintDetail::printFieldInfo(const char* name, StdfField<unsigned int>& f, long stdfRecStartBytePosition, string (*pfunct)(unsigned int)  ) {
    string nm(name);
    if (f.getTotalByteCount()== 0) {
        cout << tab1 << nm << " (nil) " << endl;
        return;
    }
    cout << tab1 << nm << endl;
    cout << tab2 << "file-byte-start-position : " << (stdfRecStartBytePosition + 4 +  f.getOffset() ) << endl;
    cout << tab2 << "offset : " << f.getOffset() << endl;
    cout << tab2 << "total-byte-count : " << f.getTotalByteCount() << endl;
    cout << tab2 << "data-byte-count : " << f.getByteCount() << endl;
    cout << tab2 << "data-value : " << f.getData() << endl;
    cout << tab2 << "date-value : " << (*pfunct)(f.getData()) << endl;
    
}



void DebugPrintDetail::printFieldInfo(const char* name, GdrStdfField& f, long stdfRecStartBytePosition ) {

   // GdrStdfField& f = *pf;

    string nm(name);
    if (f.getTotalByteCount()== 0) {
        cout << tab1 << nm << " (nil) " << endl;
        return;
    }


    cout << tab1 << nm << endl;
    cout << tab2 << "file-byte-start-position : " << (stdfRecStartBytePosition + 4 +  f.getOffset() ) << endl;
    cout << tab2 << "offset : " << f.getOffset() << endl;
    cout << tab2 << "total-byte-count : " << f.getTotalByteCount() << endl;
    cout << tab2 << "data-byte-count : " << f.getByteCount() << endl;

    switch (f.getGdrDataType()) {
    case B0: {
            cout << tab2 << "data-value : " << 0 << endl;
            break;
        }
    case U1: {
            cout << tab2 << "data-value : " << f.getData() << endl;
            break;
        }
    case U2: {
            cout << tab2 << "data-value : " << f.getData() << endl;
            break;
        }
    case U4: {
            cout << tab2 << "data-value : " << f.getData() << endl;
            break;
        }
    case I1: {
            cout << tab2 << "data-value : " << f.getData() << endl;
            break;
        }
    case I2: {
            cout << tab2 << "data-value : " << f.getData() << endl;
            break;
        }
    case I4: {
            cout << tab2 << "data-value : " << f.getData() << endl;
            break;
        }
    case R4: {
            cout << tab2 << "data-value : " << f.getData() << endl;
            break;
        }
    case R8: {
            cout << tab2 << "data-value : " << f.getData() << endl;
            break;
        }
    case CN: {
            cout << tab2 << "data-value : " << f.getData() << endl;
            break;
        }
    case BN: {
            cout << tab2 << "data-value : " << f.getData() << endl;
            break;
        }
    case DN: {
            cout << tab2 << "data-value : " << f.getData() << endl;
            break;
        }
    case N1: {
            cout << tab2 << "data-value : " << f.getData() << endl;
            break;
        }
    default:  {
            // do nothing
            break;
        }
    }

}
